import CryptoJS from 'crypto-js';

export function encryptByBase64(word) {
  return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(word));
}

export function decryptByBase64(word) {
  return CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(word));
}

export function encryptBySHA1(word) {
  return CryptoJS.SHA1(word).toString(CryptoJS.enc.Hex);
}

//  分页传参
export function addPagePath(page, limit) {
  return `${page || 1}/${limit || 10}`;
}

//  分页传参
export function addPageParam(page, limit) {
  return `&page=${page || 1}&limit=${limit || 10}`;
}
